package com.tdkj.model.enterprisezone;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.user.BeanUser;

@Entity
@Table(name = "e_product_class")
public class BeanEnterpriseProductClass extends BaseEntity{

	private String name ;
	private String description;
	private BeanEnterpriseProductClass parentClass;
	private List<BeanEnterpriseProductClass> subClass = new ArrayList<BeanEnterpriseProductClass>();
	/*是否可用,当删除一个分类时,为了不影响已经设置了此分类的产品,而设置的标识位*/
	private Integer isAvailable = 1 ; 
	private BeanEnterprise enterprise ;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	@ManyToOne(fetch = FetchType.EAGER , cascade = CascadeType.ALL)
	public BeanEnterpriseProductClass getParentClass() {
		return parentClass;
	}
	
	public void setParentClass(BeanEnterpriseProductClass parentClass) {
		this.parentClass = parentClass;
	}
	
	@OneToMany( fetch = FetchType.EAGER, mappedBy = "parentClass")
	public List<BeanEnterpriseProductClass> getSubClass() {
		return subClass;
	}
	
	public void setSubClass(List<BeanEnterpriseProductClass> subClass) {
		this.subClass = subClass;
	}
	public Integer getIsAvailable() {
		return isAvailable;
	}
	public void setIsAvailable(Integer isAvailable) {
		this.isAvailable = isAvailable;
	}

	
	@ManyToOne (fetch = FetchType.EAGER , cascade = CascadeType.ALL)
	public BeanEnterprise getEnterprise() {
		return enterprise;
	}
	public void setEnterprise(BeanEnterprise enterprise) {
		this.enterprise = enterprise;
	}
	
}